/*
 * Level.cpp
 *
 *  Created on: May 4, 2011
 *      Author: default
 */

#include <iostream>
#include "Level.h"
#include "MainGame.h"

using namespace std;

const int LevelMark_W = 21;
const int LevelMark_H = 51;

int m_LavelMarkCoords_X[5]={
		24, 75, 127, 177, 228
};

static const int m_LavelMarkCoords_Y = 732;


string m_ArrLevelCoin[5]={
		"1.png", "2.png", "3.png", "4.png", "5.png"
};


bool Level::init(){

	IndexLevel = 0;
	CoinLevel = load_image("backgrounds/1.png");
	m_LavelMark = load_image("backgrounds/level.png");

	return true;
}

void Level::LevelClick(int x, int y){

	for (int i = 0; i < 5; i++){
		if (x > m_LavelMarkCoords_X[i] && x < (m_LavelMarkCoords_X[i] + LevelMark_H) &&
				y > m_LavelMarkCoords_Y && y < (m_LavelMarkCoords_Y + LevelMark_W) )
		{
			IndexLevel = i;
			CoinLevel = load_image("backgrounds/"+m_ArrLevelCoin[IndexLevel]);
		}
	}

}

void Level::onDraw(){

	apply_surface(m_LavelMarkCoords_X[IndexLevel], m_LavelMarkCoords_Y, m_LavelMark, gMainGame.m_Screen);
	apply_surface(245, 873, CoinLevel, gMainGame.m_Screen);


}
